package innerClass.anonymousInnerClass;

public class AnonymousInnerClassDetail {
    public static void main(String[] args) {
        Outer01 outer01 = new Outer01();
        outer01.hi();
    }
}

class Outer01 {
    private int n1 = 99;
    public void hi() {
        Person p = new Person() {
            @Override
            public void hi() {
                System.out.println("匿名类的hi方法");
            }
        };
        p.hi();

        new Person() {
            @Override
            public void hi() {
                System.out.println("匿名内部类调用了hi方法");
                System.out.println("外部类的私有成员：" + n1);
            }
        }.hi();
    }
}

class Person {
    public void hi() {
        System.out.println("Person hi()");
    }
}
